package com.wn.config;


import com.wn.model.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//@ControllerAdvice  //可以在所有的Controller的接口方法中捕获异常
@RestControllerAdvice
public class MyExceptionHandler {
    
    @ExceptionHandler(Exception.class)
    public Result<String> generalExceptionHandler(Exception e){
        //记录日志.....
        e.printStackTrace();

        return Result.failResult("网络异常,请稍后再试");
    }


}
